package com.coocaa.ops.api.common.enums;

/**
 * @author zen
 * @date 2020-08-11 15:30
 * @description
 */
public enum SourceTypeEnums {
    /**
     * 渠道-腾讯
     */
    TENCENT(1, "tencent"),
    /**
     * 渠道-爱奇艺
     */
    IQIYI(2, "iqiyi"),
    /**
     * 渠道-爱奇艺2
     */
    YINHE(3, "yinhe"),
    /**
     * 渠道-优朋
     */
    VOOLE(4, "voole"),
    /**
     * 渠道-优酷
     */
    YOUKU(3,"youku"),
    /**
     * 默认
     */
    DEFAULT(0, "default");

    private int code;
    private String value;

    SourceTypeEnums(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public int getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    /**
     * 根据编码 获取对应内容源 (数据库匹配)
     *
     * @param source
     * @return
     */
    public static String getValueByCode(Integer source) {
        if (null == source) {
            return DEFAULT.value;
        }
        switch (source) {
            case 1:
                return TENCENT.value;
            case 2:
                return IQIYI.value;
            case 3:
                return YOUKU.value;
            case 0:
                return DEFAULT.value;
            default:
                return DEFAULT.value;
        }
    }

}
